﻿/* ****************************************************************************
 *
 * Copyright (c) Microsoft Corporation. 
 *
 * This source code is subject to terms and conditions of the Microsoft Public License. A
 * copy of the license can be found at http://go.microsoft.com/fwlink/?LinkID=131993. If
 * you cannot locate the Microsoft Public License, please send an email to
 * mixon@microsoft.com. By using this source code in any fashion, you are agreeing to
 * be bound by the terms of the Microsoft Public License.
 *
 * You must not remove this notice, or any other, from this software.
 *
 *
 * ***************************************************************************/

using System;
using System.Windows;
using System.Windows.Controls;

namespace MIXOnline.Descry
{
    public partial class ProcessMarker : UserControl
    {
        public ProcessMarker()
        {
            InitializeComponent();
        }

        // The ProcessMarker instantiator (Page.xaml.cs) will subscribe to the ButtonClicked event to 
        // listen for actions on this dialog, so that it can do the right thing
        public event EventHandler<MarkerEventArgs> ButtonClicked;

        void buttonNext_Click(object sender, RoutedEventArgs e)
        {
            this.OnButtonClicked(new MarkerEventArgs(MarkerEvent.Next)); 
        }

        void buttonPrevious_Click(object sender, RoutedEventArgs e)
        {
            this.OnButtonClicked(new MarkerEventArgs(MarkerEvent.Previous));
        }

        void buttonClose_Click(object sender, RoutedEventArgs e)
        {
            this.OnButtonClicked(new MarkerEventArgs(MarkerEvent.Close));
            this.Visibility = Visibility.Collapsed;
        }

        private void buttonBrowse_Click(object sender, RoutedEventArgs e)
        {
            this.OnButtonClicked(new MarkerEventArgs(MarkerEvent.Close));
            this.Visibility = Visibility.Collapsed;
        }

        internal virtual void OnButtonClicked(MarkerEventArgs e)
        {
            var eventHandler = this.ButtonClicked;
            if (eventHandler != null)
            {
                eventHandler(this, e);
            }
        }
    }



}
